package App.Utils.Security;

import org.hibernate.dialect.SybaseAnywhereDialect;
import org.springframework.stereotype.Component;

import java.math.BigInteger;
import java.security.MessageDigest;

 /**
 * 加密类
 * Created by yu on 2017/7/8.
 */
@Component
public class Encrypt
{
    public static final String KEY_SHA="SHA";
    public static String encryptPassword(String password)
    {
        //这里写加密策略
        BigInteger sha=null;
        byte[] inputData = password.getBytes();
        try {
            MessageDigest messageDigest = MessageDigest.getInstance(KEY_SHA);
            messageDigest.update(inputData);
            sha = new BigInteger(messageDigest.digest());
        } catch (Exception e) {e.printStackTrace();}
        assert sha != null;
        return sha.toString();
    }

}
